package com.Iron;


import com.Iron.Config.SpringConfig;
import com.Iron.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

//@ComponentScan
public class Spring {



    public static void main(String[] args) {

        AnnotationConfigApplicationContext cont = new AnnotationConfigApplicationContext(SpringConfig.class);
        Object myTestBean = cont.getBean("com.Iron.MyComponent.TestBean1");
        System.out.println(myTestBean);

    }
}


/*    UserService userDao = (UserService) cont.getBean("FactoryBean1");
    UserService userDao1 = (UserService) cont.getBean("FactoryBean1");
    UserService userDao2 = (UserService) cont.getBean("FactoryBean1");
    UserService userDao3 = (UserService) cont.getBean("serviceTemp");

*//*        System.out.println(userDao);
        System.out.println(userDao1);
        System.out.println(userDao2);*//*
        System.out.println( userDao3);

                cont.close();*/
/*
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        UserService userService = (UserService) context.getBean("userService");
        userDao bean =  context.getBean(userDao.class);
        System.out.println(userService);
        context.close();
        */
/*
        UserService userService = (UserService) context.getBean("userService");
        userService.call();
        */
/*
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        Object dataSource = context.getBean("dataSource");
        System.out.println(dataSource);
*/